def outer():
    print("我是外部函数！")

    def inner():
        print("我是内部函数！")

    return inner  # 返回的是函数名不要加括号


print(outer())
# result = outer()
# result()
outer()()  # 等同于  inner()

# range()函数
for i in range(0, 11, 2):
    print(i)  # 0,2,,4,6,8,10

alist = [1, 4, 6, 7, "dad"]
for i in range(len(alist)):
    print(alist[i])  # 遍历数组

# 匿名函数
a = lambda x: 1 if x > 0 else 0  # 返回值在左边 右边是逻辑 返回1或者0
print(a(-3))  # 返回0